import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] array = new int[100];
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }
        Solution solution = new Solution();
        System.out.println(solution.candy(array));
    }
}

class Solution {
    public int candy(int[] ratings) {
        int n = ratings.length;
        int res = 0;
        int[] vis = new int[n];
        Arrays.fill(vis,1);
        for (int i = 1; i < n; i++) {
            if(ratings[i]>ratings[i-1]){
                vis[i] = vis[i-1] + 1;
            }else{
                vis[i-1] = vis[i] + 1;
            }
        }
        for(int i = 0; i < n;i++){
            res+=vis[i];
            System.out.println(vis[i]);
        }
        return res;
    }
}